{% extends 'base/base.html' %}
{% load static %}

{% block title %}
Wordlist
{% endblock title %}

{% block custom_js_css_link %}
{% endblock custom_js_css_link %}

{% block breadcrumb_title %}
<li class="breadcrumb-item"><a href="{% url 'wordlist_list' current_project.slug %}">Wordlist</a></li>
<li class="breadcrumb-item active">All Worldlists</li>
{% endblock breadcrumb_title %}

{% block page_title %}
Add New Wordlist
{% endblock page_title %}

{% block main_content %}
<div class="row">
  <div class="col-12">
    <div class="card">
      <div class="p-2">
        <div class="row">
          <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
          </div>
          <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
            <a class="btn btn-soft-primary float-end ms-1" href="{% url 'add_wordlist' current_project.slug %}" data-toggle="tooltip" data-placement="top" title="Add New Wordlist">Add New Wordlist</a>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="row">
  <div class="col-12">
    <div class="card">
      <table id="wordlist_table" class="table dt-responsive w-100">
        <thead>
          <tr>
            <th>Wordlist Name</th>
            <th>Shortname</th>
            <th>Wordlist Count</th>
            <th class="text-center">Action</th>
          </tr>
        </thead>
        <tbody>
          {% for wordlist in wordlists.all %}
          <tr>
            <td>{{ wordlist.name }}</td>
            <td>{{ wordlist.short_name }}</td>
            <td>{{ wordlist.count }}</td>
            <td class="text-center">
              <a onclick="delete_api({{ wordlist.id }}, '{{ wordlist.name }}', 'wordlist')" class="btnDelWordlist text-danger" href="#" data-toggle="tooltip" data-placement="top" title="Delete Wordlist">
                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather table-delete feather-x-circle">
                  <circle cx="12" cy="12" r="10"></circle>
                  <line x1="15" y1="9" x2="9" y2="15"></line>
                  <line x1="9" y1="9" x2="15" y2="15"></line>
                </svg>
              </a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
</div>
{% endblock main_content %}


{% block page_level_script %}
<script src="{% static 'scanEngine/js/custom_scan_engine.js' %}"></script>
<script src="{% static 'custom/custom.js' %}"></script>
<script src="{% static 'targetApp/js/custom_organization.js' %}"></script>
<script>
$(document).ready(function() {
  var wordlist_table = $('#wordlist_table').DataTable({
    "oLanguage": {
      "oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
      "sInfo": "Showing page _PAGE_ of _PAGES_",
      "sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
      "sSearchPlaceholder": "Search...",
      "sLengthMenu": "Results :  _MENU_",
    },
    "dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center mt-sm-0 mt-3'f><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center'l>>>" +
    "<'table-responsive'tr>" +
    "<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count  mb-sm-0 mb-3'i><'dt--pagination'p>>",
    "lengthMenu": [5, 10, 20, 50],
    "pageLength": 50,
    "initComplete": function(settings, json) {
      $('[data-toggle="tooltip"]').tooltip();
    }
  });
  multiCheck(wordlist_table);
});
</script>
{% endblock page_level_script %}
